package top.saodisheng.dao;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.jpa.repository.JpaRepository;
import top.saodisheng.pojo.Order;
import top.saodisheng.pojo.User;
import top.saodisheng.pojo.Vehicle;

import java.util.Date;
import java.util.List;

/**
 * Description:
 *
 * @author 扫地生_saodisheng
 */
public interface OrderDao extends JpaRepository<Order, Integer> {
    // 通过寄件人获取订单
    List<Order> findBySender(User sender);

    // 通过寄件人、运输工具、订单创建时间查询订单
    List<Order> findBySenderAndVehicleAndCreateDateBetween(User sender, Vehicle vehicle, Date startTime, Date endTime);

    // 通过寄件人、订单创建时间查询订单
    List<Order> findBySenderAndCreateDateBetween(User sender, Date startTime, Date endTime);

    // 通过运输工具、订单创建时间查询订单
    List<Order> findByVehicleAndCreateDateBetween(Vehicle vehicle, Date startTime, Date endTime);

    // 通过订单创建时间来查询时间
    List<Order> findByCreateDateBetween(Date startTime, Date endTime);

}
